include ../Makefile.shared

define PROJ_bp
  SOURCES = infShared.ml bpImpl.ml bpShared.ml bp.ml
  RESULT = bp
endef
export PROJ_bp

define PROJ_maxprod
  SOURCES = infShared.ml bpImpl.ml bpShared.ml maxprod.ml
  RESULT = maxprod
endef
export PROJ_maxprod

define PROJ_gibbs
  SOURCES = gibbsImpl.ml gibbs.ml 
  RESULT = gibbs
endef
export PROJ_gibbs

define PROJ_icm
  SOURCES = infShared.ml gibbsImpl.ml icm.ml 
  RESULT = icm
endef
export PROJ_icm

define PROJ_mf
  SOURCES = infShared.ml mfImpl.ml mf.ml 
  RESULT = mf
endef
export PROJ_mf

define PROJ_acquery
  SOURCES = infShared.ml acquery.ml 
  RESULT = acquery
  LIBS = ext str data mn circuit
endef
export PROJ_acquery

# If the environment does not define subprojects to handle,
# then set a default
ifndef SUBPROJS
  export SUBPROJS = bp maxprod gibbs icm mf acquery
endif

export LIBS=ext str data expat lbfgs mn bn

# Default target to use
all: nc
	cp $(SUBPROJS) $(BINDIR)

# Catch-all target will be applied to all subprojects automatically
%:
	@$(MAKE) -f $(OCAMLMAKEFILE) subprojs SUBTARGET=$@
